﻿using System;
using ThinkGeo.MapSuite.Core;
using ThinkGeo.MapSuite.WebEdition;
using System.Data.SqlClient;
using System.Configuration;  

namespace NghiSonStyle
{
    public partial class TestStyle : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ShapeFileFeatureSource.BuildIndexFile(MapPath("~/Data/Style.shp"), BuildIndexMode.Rebuild);
                string a = "#FFFFFF";
                string b = "#9455C7";
                Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml(a));
                Map1.CurrentExtent = new RectangleShape(105.71091, 19.34982, 105.78240, 19.34982);
                Map1.MapUnit = GeographyUnit.DecimalDegree;
                Map1.MapTools.MouseCoordinate.Enabled = true;
                SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["dbconnection"].ToString());
                con.Open();
                
                //Dat Duong
                ShapeFileFeatureLayer LongDuongPLG = new ShapeFileFeatureLayer(MapPath("~/Data/Style.shp"));               
                LongDuongPLG.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromHtml(b), GeoColor.FromArgb(255, 132, 132, 154), 0);
                LongDuongPLG.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
                ShapeFileFeatureLayer Nettimduong_polyline = new ShapeFileFeatureLayer(MapPath("~/Data/Style.shp"));
                Nettimduong_polyline.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.StateBorder1;
                Nettimduong_polyline.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
                LayerOverlay staticOverlay = new LayerOverlay();
                staticOverlay.IsBaseOverlay = false;
                staticOverlay.Layers.Add(Nettimduong_polyline);
                Map1.CustomOverlays.Add(staticOverlay);
            }  
        }
    }
}